Simple Console abstraction RusPiRo crate
This crate provides a console abstraction to enable string output to a configurable output channel.
It also provides the convinient macros (print!
and println!
) to output text that are usually not
available in [no_std]
environments. However this crate also provide macros to indicate the severity of the
message that shall be printed. Those are info!
, warn!
and error!
.
Dependencies
This crate uses macros to provide formatted strings. This formatting requires a memory allocator to
be present (as part of the alloc
crate). So when using this crate provide an allocator such as
ruspiro_allocator
.
Usage
To use the crate just add the following dependency to your Cargo.toml
file:
[]
= "0.3"
Once the console crate is available the common macros used to output strings print!
and println
could be used.
However, without actually setting a console output those statements will not write any data anywhere:
use *;
To actually set an active output channel you need to provide a structure that implements the ConsoleImpl
trait. This
for example is done in the Uart like so:
If this trait has been implemented this structure can be used as actual console. To use it there should be the following code written at the earliest possible point in the main crate of the binary (e.g. the kernel)
use *;
use *; // as we demonstrate the usage with the Uart.
License
Licensed under Apache License, Version 2.0, (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)